using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
using static UnityEditor.Timeline.TimelinePlaybackControls;

public class SunPointText : MonoBehaviour
{
    private TextMeshProUGUI sunText;

    
    private void SunChanged(int sun)
    {
        sunText.text = SunManager.Instance.curSun.ToString();
    }

    private void OnEnable()
    {
        gameObject.TryGetComponent<TextMeshProUGUI>(out sunText);

        GameEventsManager.Instance.SunChangedEvent.AddListener(SunChanged);
    }

    private void OnDisable()
    {
        GameEventsManager.Instance.SunChangedEvent.RemoveListener(SunChanged);
    }
}
